package org.dbstar.scheduler.control.db;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

/**
 * 增加两个方法，用于读取对象形式的Int和Long字段，可识别null值
 * 
 * @author 代波
 * @since 1.0.0
 * @version 1.0.0
 * @date 2012-4-21
 */
public abstract class ObjectRowMapper<T> implements RowMapper<T> {
	protected static final Integer getIntObject(ResultSet rs, String columnLabel) throws SQLException {
		return rs.getObject(columnLabel) == null ? null : rs.getInt(columnLabel);
	}

	protected static final Long getLongObject(ResultSet rs, String columnLabel) throws SQLException {
		return rs.getObject(columnLabel) == null ? null : rs.getLong(columnLabel);
	}
}
